define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'ykjp/purchase/retire/index' + location.search,
                    add_url: 'ykjp/purchase/retire/add',
                    edit_url: 'ykjp/purchase/retire/edit',
                    detail_url: "ykjp/purchase/retire/detail",
                    del_url: 'ykjp/purchase/retire/del',
                    multi_url: 'ykjp/purchase/retire/multi',
                    table: 'ykjp_retire',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true, formatter: function (value, row, index) {
                                if (row.status == 0) {
                                    return {
                                        disabled: false,
                                    };
                                } else {
                                    return {
                                        disabled: true,
                                    }

                                }
                            }},
                        {field: 'code', title: __('Code')},
                        {field: 'supplier.name', title: __('Supplier.name')},
                        {field: 'billing_time', title: __('Billing_time'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'remark', title: __('Remark')},
                        {field: 'status', title: __('Status'), searchList: {"0": __('Status 0'), "1": __('Status 1'), "2": __('Status 2'), "3": __('Status 3'), "4": __('Status 4')}, formatter: Table.api.formatter.status},
                        {field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'updatetime', title: __('Updatetime'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
                        {
                            field: 'operate',
                            title: __('Operate'),
                            table: table,
                            events: Table.api.events.operate,
                            buttons: [
                                {
                                    name: 'detail',
                                    title: __('look'),
                                    classname: 'btn btn-xs btn-primary  btn-addtabs',
                                    icon: 'fa fa-pencil-square-o',
                                    url: $.fn.bootstrapTable.defaults.extend.detail_url,
                                },
                            ],
                            formatter: function (value, row, index) {
                                var that = $.extend({}, this);
                                var table = $(that.table).clone(true);
                                if (row.status == 3 || row.status == 4) {
                                    $(table).data("operate-del", null);
                                }
                                that.table = table;
                                return Table.api.formatter.operate.call(that, value, row, index);
                            }
                        }
                    ]
                ]
            });


            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        recyclebin: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    'dragsort_url': ''
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: 'ykjp/purchase/retire/recyclebin' + location.search,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {
                            field: 'deletetime',
                            title: __('Deletetime'),
                            operate: 'RANGE',
                            addclass: 'datetimerange',
                            formatter: Table.api.formatter.datetime
                        },
                        {
                            field: 'operate',
                            width: '130px',
                            title: __('Operate'),
                            table: table,
                            events: Table.api.events.operate,
                            buttons: [
                                {
                                    name: 'Restore',
                                    text: __('Restore'),
                                    classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
                                    icon: 'fa fa-rotate-left',
                                    url: 'ykjp/purchase/retire/restore',
                                    refresh: true
                                },
                                {
                                    name: 'Destroy',
                                    text: __('Destroy'),
                                    classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
                                    icon: 'fa fa-times',
                                    url: 'ykjp/purchase/retire/destroy',
                                    refresh: true
                                }
                            ],
                            formatter: Table.api.formatter.operate
                        }
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            $('#myModal').on('show.bs.modal', function (e) {
                Controller.supplier();
            });
            setnums();
            $('#myModal').on('hidden.bs.modal', function () {
                $('#table1').bootstrapTable('destroy');
            });

            $('#modelProduct').on('hidden.bs.modal', function () {
                $('#table2').bootstrapTable('destroy');
            });

            $(document).on("click", ".addrow", function () {
                addRow();
            })
            $(document).on("click", ".find", function (e) {
                var fist = $("#hose-fist").val();
                if (fist == "") {
                    Layer.alert(__('Please select a warehouse'));
                } else {

                    Controller.getProduct($(this));
                    $('#modelProduct').modal('show');
                }
            })
            $('#c-supplier').focus(function () {
                $('#myModal').modal('show');
            });
            Controller.api.bindevent();
        },
        edit: function () {
            $('#myModal').on('show.bs.modal', function (e) {
                Controller.supplier();
            });
            $('#myModal').on('hidden.bs.modal', function () {
                $('#table1').bootstrapTable('destroy');
            });
            $('#modelProduct').on('hidden.bs.modal', function () {
                $('#table2').bootstrapTable('destroy');
            });
            $('#modelProduct').on('show.bs.modal', function (e) {

                var btn = $(e.relatedTarget)
                Controller.getProduct(btn);
            });
            $('#c-supplier').focus(function () {
                $('#myModal').modal('show');
            });

            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        },
        supplier: function () {
            Table.api.init({
                extend: {
                    index_url: 'ykjp/purchase/addorder/index?a=1'
                }
            });

            var table = $("#table1");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                commonSearch: false,
                columns: [
                    [
                        {field: 'name', title: __('Name')},
                        {field: 'contact', title: __('Contact')},
                        {field: 'phone', title: __('Phone')},
                        {field: 'description', title: __('Description')},
                        {
                            field: 'operate',
                            width: "120px",
                            title: __('Selected'),
                            table: table,
                            events: Table.api.events.operate,
                            buttons: [
                                {
                                    name: 'ajax',
                                    text: __('Selected'),
                                    title: __('Selected'),
                                    classname: 'btn btn-xs btn-success btn-magic btn-ajax',
                                    icon: 'fa fa-magic',
                                    url: 'ykjp/purchase/addorder/getSupperByid',
                                    success: function (data, ret) {
                                        $("#c-supplier").val(data.row.name);
                                        $("#c-supId").val(data.row.id);

                                        $('#myModal').modal('hide');
                                        //如果需要阻止成功提示，则必须使用return false;
                                        //return false;
                                    },
                                    error: function (data, ret) {
                                        Layer.alert(ret.msg);
                                        return false;
                                    }
                                },
                            ],
                            formatter: Table.api.formatter.buttons
                        }
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        getProduct: function (btn) {
            Table.api.init({
                extend: {
                    index_url: 'ykjp/purchase/addorder/index?a=2'
                }
            });

            var table = $("#table2");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                commonSearch: false,
                escape: false,
                columns: [
                    [
                        {field: 'name', title: __('Name')},
                        {field: 'specification', title: __('Specification')},
                        {field: 'sku', title: __('Sku')},
                        {field: 'prop', title: __('Prop'), formatter: function (value, row, index) {
                                var str = "";
                                if (row.prop != "") {
                                    var arr = JSON.parse(row.prop);
                                    console.log(arr[0]);

                                    for (var i = 0; i < arr.length; i++) {

                                        if (typeof (arr[i]['value']) != "undefined" && arr[i]['value'] !== null) {
                                            str += arr[i]['title'] + ":" + arr[i]['value'] + ";<br>";
                                        }
                                    }
                                }
                                return str;
                            }},
                        {
                            field: 'operate',
                            width: "120px",
                            title: __('Selected'),
                            table: table,
                            events: Table.api.events.operate,
                            buttons: [
                                {
                                    name: 'ajax',
                                    text: __('Selected'),
                                    title: __('Selected'),
                                    classname: 'btn btn-xs btn-success btn-magic btn-ajax',
                                    icon: 'fa fa-magic',
                                    url: 'ykjp/purchase/addorder/getProductByid',
                                    success: function (data, ret) {
                                        var _this = btn.parent().parent();
                                        _this.find(".find").val(data.row.name);
                                        _this.find(".find").attr("data-id", data.row.id);
                                        _this.find(".unit").text(data.row.unit);
                                        _this.find("td:eq(1)").text(data.row.sku);
                                        _this.find("td:eq(3)").text(data.row.specification);
                                        if (data.row.prop != "") {
                                            var arr = JSON.parse(data.row.prop);
                                            var str = "";
                                            for (var i = 0; i < arr.length; i++) {
                                                if (typeof (arr[i]['value']) != "undefined" && arr[i]['value'] !== null) {
                                                    str += arr[i]['title'] + ":" + arr[i]['value'] + "; <br>";
                                                }
                                            }
                                            _this.find("td:eq(4)").html(str);
                                        }
                                        $('#modelProduct').modal('hide');
                                        //如果需要阻止成功提示，则必须使用return false;
                                        //return false;
                                    },
                                    error: function (data, ret) {
                                        Layer.alert(ret.msg);
                                        return false;
                                    }
                                },
                            ],
                            formatter: Table.api.formatter.buttons
                        }
                    ]
                ]
            });
            Table.api.bindevent(table);

        }
    };
    return Controller;
});

// 添加
function addRow() {
    var len = $('#table tr').length - 1;
    var lens = len - 2;
    var tr = $("#table tbody tr").eq(0).clone();
    $('#table tbody tr:eq(' + lens + ')').after(tr);
    var theng = lens + 1;
    $('#table tbody tr:eq(' + theng + ')').find(".find").val("");
    $('#table tbody tr:eq(' + theng + ')').find(".find").attr("data-id", "");
    $('#table tbody tr:eq(' + theng + ')').find(".find").attr("value", "");
    $('#table tbody tr:eq(' + theng + ')').find(".prid").attr("data-id", "");
    $('#table tbody tr:eq(' + theng + ')').find(".t-nums").text("");
    $('#table tbody tr:eq(' + theng + ')').find("select").val("");
    $('#table tbody tr:eq(' + theng + ')').find(".t-sku").text("");
    $('#table tbody tr:eq(' + theng + ')').find(".guige").text("");
    $('#table tbody tr:eq(' + theng + ')').find(".ts").text("");
    $('#table tbody tr:eq(' + theng + ')').find(".t-sx").text("");
    $('#table tbody tr:eq(' + theng + ')').find(".unit").text("");
    $('#table tbody tr:eq(' + theng + ')').find("textarea").text("");
    $('#table tbody tr:eq(' + theng + ')').find(".subtotal").text("");
    $('#table tbody tr:eq(' + theng + ')').find(".nums").val("");
    $('#table tbody tr:eq(' + theng + ')').find(".unit-price").val("");
    $('#table tbody tr:eq(' + theng + ')').find(".unit-price").attr("value", "");
    $('#table tbody tr:eq(' + theng + ')').find(".nums").attr("value", "");
    setnums();
}



// function getSecond(){
//     var pid=$("#hose-fist").val();
//     $.ajax({
//         url:'purchase/addorder/getWarehouse?pid='+pid,
//         success:function(result){
//             var data=result.data;
//             console.log(result.data.length)
//             var str="<option value=''>请选择</option>";
//            if(data.length>0){
//             $(".second").removeAttr("disabled");
//                for (var i = 0; i<data.length; i++) {
//                  var st="<option value='"+data[i]['value']+"''>"+data[i]['name']+" </option>"; 
//                  str+=st;
//                }
//               $(".second").find("option").remove(); 
//               $(".second").append(str); 
//            }else{
//              $(".second").find("option").remove(); 
//               $(".second").attr("disabled","disabled");
//            }
//         }});
// }



// 删除
function delRow(obj) {

    if ($('#table tbody tr').length == 2) {
        alert(__("Can't delete"));
        return false;
    }
    $(obj).parent().parent().remove();
    totalNums(null);
    calTotalMoneys()
    setnums();
}

//设置序号
function setnums() {
    var len = $('#table tr').length;
    for (var i = 1; i < len - 1; i++) {
        $('#table tr:eq(' + i + ') td:first').text(i);
    }
}

//计算总数量
function totalNums(obj) {
    var len = $('#table tr').length;
    var total = 0;
    if (obj != null) {
        calMoney(obj);
    }
    for (var i = 1; i < len - 1; i++) {
        var nums = $('#table tr:eq(' + i + ') .nums').val();
        if (nums == "") {
            nums = 0;
        } else {
            nums = getNumValue(nums);
            if (nums == false || nums < 0) {
                total = false;
                return false;
            }
        }
        total += nums;
    }
    if (total != false) {
        $(".totalnums").text(total);
        $("#allNums").val(total);
    }
}

function getNumValue(num) {
    if (!isNaN(num) && num != "") {
        num = parseFloat(num);
        var a = isPositiveInteger(num)
        if (a == false) {
            num = false;
        }
    } else {
        num = false;
    }
    return num;
}

function isInteger(obj) {
    return obj % 1 === 0
}

function isPositiveInteger(s) {//是否为正整数
    var re = /^[0-9]+$/;
    return re.test(s)
}
// 小计
function calMoney(obj) {
    var total = 0;
    var nums = $(obj).parent().parent().find(".nums").val();
    var nuitprice = $(obj).parent().parent().find(".unit-price").val();
    if (nuitprice == "") {
        return false;
    }
    nuitprice = parseFloat(nuitprice);
    nums = getNumValue(nums);
    if (nums == false) {
        return false;
    }
    total = nuitprice * nums;
    total = total.toFixed(2);
    $(obj).parent().parent().find(".subtotal").text(total);
    calTotalMoneys();
}
// 计算总金额
function calTotalMoneys() {
    var len = $('#table tr').length;
    var total = 0;
    for (var b = 1; b < len - 1; b++) {
        var str = '#table tr:eq(' + b + ') .subtotal';
        var a = $(str).text();
        if (a == "") {
            a = 0;
        }
        a = parseFloat(a);
        if (a == "NaN" || a == "" || a == undefined) {
            a = 0;
        }
        total += a;
    }
    $("#table #allMoney").text(total);
    var rate = $("#c-rate").val();
    rate = parseFloat(rate);
    // var totalMoney=total*(1+rate/100);
    $("#money").val(total);
    $("#totalMoney").text(total);

}
// 添加
function submitData() {
    var data = $("#add-form").serialize();
    if ($("#c-supId").val() == '') {
        Layer.alert(__("Please select a merchant"));
        return false;
    }
    if ($("#hose-fist").val() == 0) {
        Layer.alert(__("Please select a warehouse"));
        return false;
    }
    $('#add-form').isValid(function (v) {
        if (v == true) {
            var len = $("#table tr").length;
            var arr = new Array();
            var arrtep = new Array();
            var c = [];
            for (var i = 1; i < len - 1; i++) {
                var id = $("#table tr:eq(" + i + ")").find('.find').attr("data-id");
                if (id == "") {
                    Layer.alert(__("Please select a product"));
                    return false;
                }

                var nums = $("#table tr:eq(" + i + ")").find('.nums').val();
                var unitPrice = $("#table tr:eq(" + i + ")").find('.unit-price').val();
                var subtotal = $("#table tr:eq(" + i + ")").find('.subtotal').text();
                var unit = $("#table tr:eq(" + i + ")").find('.unit').text();
                var remarks = $("#table tr:eq(" + i + ")").find('.remarks').val();
                var partition_id = $("#table tr:eq(" + i + ") .second").attr("data-id");
                arr.push({"product_id": id, "price": unitPrice, "nums": nums, "subtotal": subtotal, "unit": unit, "remark": remarks, "partition_id": partition_id});
            }
            var temp = JSON.stringify(arr);
            resutlData = data + "&" + "product=" + temp;
            // data.push({"name":"row['product']","value":temp});
            // var resutlData=JSON.stringify(data);
            // console.log(resutlData)
            Fast.api.ajax({
                url: 'ykjp/purchase/retire/add',
                data: resutlData
            }, function (data, ret) {
                //成功的回调

                if (data.result = "success") {

                    layer.msg('成功提交', {
                        time: 2000, //2s后自动关闭
                        end: function () {
                            location.href = data.url;
                        }
                    });
                }
                // console.log(data);
                // return false;
            }, function (data, ret) {
                //失败的回调
                Layer.alert(ret.msg);
                // alert(ret.msg);
                return false;
            });
        }
    })

}

// function delTbale(){
//   $("#table tbody tr:not(:first):not(:last)").html("");
//    $('#table tbody tr:eq(0)').find(".find").val("");
//    $('#table tbody tr:eq(0)').find(".find").attr("data-id","");
//    $('#table tbody tr:eq(0)').find(".t-nums").text("");
//    $('#table tbody tr:eq(0)').find("select").val("");
//    $('#table tbody tr:eq(0)').find(".t-sku").text("");
//    $('#table tbody tr:eq(0)').find(".guige").text("");
//    $('#table tbody tr:eq(0)').find(".t-sx").text("");
//    $('#table tbody tr:eq(0)').find(".ts").text("");
//    $('#table tbody tr:eq(0)').find(".unit").text("");
//    $('#table tbody tr:eq(0)').find("textarea").text("");
//    $('#table tbody tr:eq(0)').find(".subtotal").text("");
//    $('#table tbody tr:eq(0)').find(".nums").val("");
//    $('#table tbody tr:eq(0)').find(".unit-price").val("");
//    $("#money").val("0");
//    $("#totalMoney").text("0");
//    $(".totalnums").text("0");
//    $("#allNums").val("0");
// }

function ProductPost(obj, id) {
    var len = $('#table tr').length;
    for (var i = 0; i < len; i++) {
        var a = $('#table tr:eq(' + i + ') td').find(".find").attr('data-id');
        var b = $('#table tr:eq(' + i + ') td .second').val();
        if (obj == a && id == b) {
            // console.log(111)
            return false;
        }
    }
    return true;
}


//修改
function updateData(obj) {
    var data = $("#add-form").serialize();
    if ($("#c-supId").val() == '') {
        Layer.alert(__("Please select a merchant"));
        return false;
    }
    if ($("#hose-fist").val() == 0) {
        Layer.alert(__("Please select a warehouse"));
        return false;
    }
    $('#add-form').isValid(function (v) {
        if (v == true) {
            var len = $("#table tr").length;
            var arr = new Array();
            var arrtep = new Array();
            var c = [];
            for (var i = 1; i < len - 1; i++) {
                var id = $("#table tr:eq(" + i + ")").find('.find').attr("data-id");
                var data_id = $("#table tr:eq(" + i + ")").find('.prid').attr("data-id");
                if (id == "") {
                    Layer.alert(__("Please select a product"));
                    return false;
                }

                var nums = $("#table tr:eq(" + i + ")").find('.nums').val();
                var unitPrice = $("#table tr:eq(" + i + ")").find('.unit-price').val();
                var subtotal = $("#table tr:eq(" + i + ")").find('.subtotal').text();
                var unit = $("#table tr:eq(" + i + ")").find('.unit').text();
                var remarks = $("#table tr:eq(" + i + ")").find('.remarks').val();
                var partition_id = $("#table tr:eq(" + i + ") .second").attr("data-id");
                arr.push({"product_id": id, "price": unitPrice, "nums": nums, "subtotal": subtotal, "unit": unit, "remark": remarks, "partition_id": partition_id, "data_id": data_id});
            }

            var temp = JSON.stringify(arr);
            resutlData = data + "&" + "product=" + temp;
            Fast.api.ajax({
                url: 'ykjp/purchase/retire/edit?ids=' + obj,
                data: resutlData
            }, function (data, ret) {
                //成功的回调

                if (data.result = "success") {

                    layer.msg('成功提交', {
                        time: 2000, //2s后自动关闭
                        end: function () {
                            location.reload();
                        }
                    });
                }
                // console.log(data);
                // return false;
            }, function (data, ret) {
                //失败的回调
                Layer.alert(ret.msg);
                // alert(ret.msg);
                return false;
            });
        }
    })

}

function confirmYes(id) {
    Fast.api.ajax({
        url: "ykjp/purchase/retire/confirm?ids=" + id,
        data: {"type": "yes"}
    }, function (data, ret) {
        //成功的回调
        if (data.result = "success") {
            layer.msg('成功提交', {
                time: 2000, //2s后自动关闭
                end: function () {
                    location.reload();
                }
            });
        }
    }, function (data, ret) {
        return false;
    });
}


function confirmNo(id) {
    var why = $("#why").val();
    Fast.api.ajax({
        url: "ykjp/purchase/retire/confirm?ids=" + id,
        data: {"type": "no", "why": why}
    }, function (data, ret) {
        //成功的回调
        if (data.result = "success") {
            layer.msg('成功提交', {
                time: 2000, //2s后自动关闭
                end: function () {
                    location.reload();
                }
            });
        }
    }, function (data, ret) {
        return false;
    });
}

function approval(obj, id) {
    Fast.api.ajax({
        url: "ykjp/purchase/ret_review/reviewRet?ids=" + id,
        data: {"type": obj}
    }, function (data, ret) {
        //成功的回调
        if (data.result = "success") {
            layer.msg('成功提交', {
                time: 2000, //2s后自动关闭
                end: function () {
                    location.reload();
                }
            });
        }
    }, function (data, ret) {
        alert(ret.msg);
        return false;
    });
}

function Anti(obj) {
    Fast.api.ajax({
        url: "ykjp/purchase/retire/Anti?ids=" + obj,
    }, function (data, ret) {
        //成功的回调
        if (data.result = "success") {
            layer.msg('成功提交', {
                time: 2000, //2s后自动关闭
                end: function () {
                    location.reload();
                }
            });
        }
    }, function (data, ret) {
        alert(ret.msg);
        return false;
    });
}




function appWhy(id) {
    var str = "<div  style='width:80%;margin-left:auto;margin-right:auto'><textarea class='reason' rows='3' cols='38'></textarea></div>";
    Layer.open({
        title: __('Please fill in the reason'), //页面标题
        content: str,
        area: ['400px', '230px'], //自定义文本域宽高
        btn: ['确定', '取消'],
        yes: function (e, value) {
            var reason = $(".reason").val().trim();
            if (reason == "") {
                alert(__("Reason cannot be empty"));
            } else {
                apprNo(reason, id);
            }
        }, btn2: function () {
            return 0;
        }
    })
}


function apprNo(why, id) {
    Fast.api.ajax({
        url: "ykjp/purchase/ret_review/reviewRet?ids=" + id,
        data: {"type": "no", "reason": why}
    }, function (data, ret) {
        //成功的回调

        if (data.result = "success") {

            layer.msg('成功提交', {
                time: 2000, //2s后自动关闭
                end: function () {
                    location.reload();
                }
            });
        }
    }, function (data, ret) {
        Layer.alert(ret.msg);
        return false;
    });
}

function printPdf() {
    var headerText = $(".panel-heading").text();
    $(".panel-heading").text("采购退货单").css({
        "width":"300px",
        "margin":"0 auto",
        "font-size":"50px",
    });
    $(".prindBody .print-row,.prindBody .code label,.prindBody .code div").removeClass("col-xs-12").css({"float":"left"});
    $(".prindBody .print-row").removeClass("col-xs-12").addClass("col-xs-6").css({"float":"left"});
    $(".prindBody .print-row div , .prindBody .print-row label,.prindBody .print-remark div,.prindBody .print-remark label").removeClass("col-xs-12").css({"float":"left"});
    $(".print-total .print-total-row .print-row").removeClass("col-xs-12").css({"float":"right","width":"30%","margin-right":"-10%"});
    $(".print-total-row .print-row div,.print-total-row .print-row label").removeClass("col-xs-12");

    $("#ribbon").css('display','none');
    $(".no-print").css('display','none');
    window.print();

    $(".prindBody .print-row,.prindBody .code label,.prindBody .print-row,.prindBody .code div").addClass("col-xs-12").removeAttr("style");
    $(".prindBody .print-row").removeClass("col-xs-6").addClass("col-xs-12").removeAttr("left");
    $(".prindBody .print-row div , .prindBody .print-row label,.prindBody .print-remark div,.prindBody .print-remark label").addClass("col-xs-12").removeAttr("style");

    $(".print-total .print-total-row .print-row").addClass("col-xs-12").removeAttr("style");
    $(".print-total-row .print-row label,.print-total-row .print-row div").addClass("col-xs-12").removeAttr("style");;
    $(".no-print").css('display','block');
    $("#ribbon").css('display','block');
    $(".panel-heading").text(headerText).removeAttr("style");
}


